#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 2e5 + 10, INF = 0x3f3f3f3f;

ll n, q;
ll ans[N];

void solve()
{
    memset(ans, 0, sizeof ans);
    cin >> n >> q;
    ll sum = 0;
    while (q--) {
        ll a, b;cin >> a >> b;
        ll x = a / n, y = a % n;
        sum += x;
        ans[b]++;

        if (b + y <= n) {
            ans[b + y]--;
        } else {
            ans[0]++;
            ans[y - n + b]--;
        }
    }
    for (ll i = 0;i < n;i++) {
        ans[i + 1] += ans[i];
        cout << sum + ans[i] << ' ';
    }
    cout << '\n';
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
    // #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    cin >> T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}